package cn.wolfcode.wolf2w.controller;

import cn.wolfcode.wolf2w.domain.StrategyComment;
import cn.wolfcode.wolf2w.query.StrategyCommentQueryObject;
import cn.wolfcode.wolf2w.service.IStrategyCommentService;
import cn.wolfcode.wolf2w.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("strategyComment")
public class StrategyCommentController {

    @Autowired
    private IStrategyCommentService strategyCommentService;

    @RequestMapping("/list")
    public String list(Model model, @ModelAttribute("qo") StrategyCommentQueryObject qo) {
        Page<StrategyComment> list = strategyCommentService.query(qo);
        model.addAttribute("page", list);
        return "strategyComment/list";
    }

    @RequestMapping("/getStrategyCommentById")
    @ResponseBody
    public Object getStrategyCommentById(String sid) {
        StrategyComment strategyComments = strategyCommentService.get(sid);
        return strategyComments;
    }

}
